﻿using System;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

namespace Common
{
   public class Connect
    {
       static String strConnec =MaHoa.GiaiMaDES("thanhbinh",ConfigurationManager.ConnectionStrings["Myconnected"].ConnectionString.ToString());
       static SqlConnection conn = new SqlConnection(strConnec);
       public Connect()
       {
           if (conn==null)
                {
                    conn = new SqlConnection(strConnec);
                }     
       }      
       public static string strConnected()
       {
           return strConnec;
       }
       public static SqlConnection Connected()
       {
           try
           {
               if (conn.State == ConnectionState.Closed)
                   conn.Open();
           }
           catch { }
                  
           return conn;

       }
    }
}
